package com.isoft.demo.controller;

import com.isoft.demo.common.ResponseData;
import com.isoft.demo.entity.Filial;
import com.isoft.demo.service.FilialService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@CrossOrigin
public class FilialController {
    @Autowired
    private FilialService service;

    @GetMapping("/searchAll")
    public ResponseData searchAll(){
        ResponseData rs = service.searchAll();
        return rs;
    }
    @GetMapping("/addFil")
    public ResponseData addFil(Filial filial){
        ResponseData rs = service.addFil(filial);
        return rs;
    }
    @GetMapping("/updateFil")
    public ResponseData updateFil(Filial filial){
        ResponseData rs =service.updateFil(filial);
        return rs;
    }
//    @GetMapping("/deleteFil")
//    public ResponseData deleteFil(@Param(value = "fid") int fid){
//        ResponseData rs =service.deleteFil(fid);
//        return rs;
//    }
    @GetMapping("/byFid")
    public ResponseData findByFid(Integer fid){
        ResponseData rs= service.findByFid(fid);
        return rs;
    }
}
